<!DOCTYPE html> 
<!--
 Copyright (c) 2010 - 2016 TU Wien ACIN, Profactor GmbH, fortiss GmbH
               2018 Johannes Kepler University 
  
 This program and the accompanying materials are made available under the
 terms of the Eclipse Public License 2.0 which is available at
 http://www.eclipse.org/legal/epl-2.0.

 SPDX-License-Identifier: EPL-2.0
 
 Contributors:
   Carolyn Oates, Monika Wenger, Gerhard Ebenhofer, Alois Zoitl, 
   Waldemar Eisenmenger, Gerd Kainz, Jose Cabral
     - initial API and implementation and/or initial documentation
   Alois Zoitl - updated to latest build process and repositories  
-->

<html lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<title>Building and Running 4diac IDE</title>
	<link rel="stylesheet" type="text/css" href="../help.css">
</head>

<body>
<h1 id="topOfPage">Building and Running 4diac IDE</h1>

<p>You have 2 options for building and running 4diac IDE:</p>
<ol>
	<li><a href="#buildFromSource">Building and Running 4diac IDE from Source</a></li>
	<li><a href="#buildBinary">Building a Binary 4diac IDE Package from Source</a></li>
</ol>

<h2 id="buildFromSource">Building and Running 4diac IDE from Source</h2>

<p>Run through the following steps to build and execute the 4diac IDE from source:</p>
<ol>
	<li>Get the development environment</li>
	<li>Check out the 4diac IDE repository</li>
	<li>Import plug-ins into workspace</li>
	<li>Set the target platform</li>
	<li>Run in development mode</li>
</ol>


<h3 id="devEnvironment">Get the Development Environment</h3>

<p>Get the latest <a href="https://eclipse.org/downloads/eclipse-packages/" target="_blank">Eclipse IDE</a>. 
Use <span class="specificText">Eclipse Modeling Tools</span> edition. 

<h3 id="checkOutRepos">Check out the 4diac IDE Repository</h3>
<p>This section shows how to check out (clone) the 4diac IDE repository. 
You will need <a href="https://git-scm.com/downloads" target="_blank">Git</a> to download it by using the <span class="inlineCode">clone</span> command from Git to the repository <span class="address"> https://git.eclipse.org/r/4diac/org.eclipse.4diac.ide</span>. 
If you're using the terminal, do:</p>

<div class="code">$ cd ~ 
$ git clone https://git.eclipse.org/r/4diac/org.eclipse.4diac.ide</div>

<p>The code will be copied to the new created folder ~/org.eclipse.4diac.ide.</p>

<p>You can also use the git integrated into Eclipse for this process. Please refere to the Eclipse EGit documentation on how to clone a repository</p>

<h3 id="importPlugins">Import Plug-Ins into Workspace</h3>
<ol>
	<li><span class="menu4diac">File &rarr; Import &rarr; General &rarr; Existing Projects into Workspace</span></li>
	<li>Under <span class="menu4diac">Select root directory</span> select the source directory from the file system and mark all projects to be imported.</li>
	<li>Wait till Eclipse finished building the project (look at the progress bar at the right bottom corner of the Eclipse main window)</li>
	<li>Check problems view for errors. If you get <span class="specificText">API Baseline</span> not set errors you need to perform the following steps: 
		<ol>
			<li>Open the Eclipse preferences: <span class="menu4diac">Window &rarr; Preferences</span></li>
			<li>Enter API in the top left search field. You should get three research results: 1. <span class="specificText">API Baselines</span>, 2. <span class="specificText">API Errors/Warnings</span>, and 3. <span class="specificText">API Use Scans</span></li>
			<li>You now have two options: 
				<ol>
					<li>Set an API Baseline for your developments:
						<ul>
							<li>Select: API Baseline</li>
							<li>Click Add Baseline ...</li>
							<li>Enter a name, e.g., MyEclipse</li>
							<li>For the location select your Eclipse directory</li>
							<li>Press Finish</li>
							<li>Select your new baseline in the API Baselines window and press OK</li>
						</ul>
					</li>
					<li>Set the API Baseline error to ignore: 
						<ul>
							<li>Select: API Baseline</li>
							<li>Set the option Missing API Baseline: which can be found in the bottom of the preferences window from Error to Ignore</li>
						</ul>
						<div><img src="../../html/development/img/APIbaseline.png" alt="API Baseline"/></div>
					</li>
				</ol>
			</li>
		</ol>
	</li>
</ol>

<h3 id="targetPlatform">Set Target Platform</h3>
<ol>
    <li>Open the Eclipse preferences within the <span class="inlineCode">org.eclipse.fordiac.ide.product</span> plugin:
    <div><img src="../../html/development/img/TargetPlatform.png" alt="Eclipse target platform configuration"/></div></li>
    <li>Wait until the target platform is resolved or press <span class="button4diac">Reload</span> and wait until it is resolved</li>
    <li>Press <span class="button4diac">Set as Target Platform</span> within the upper right corner and wait until the workspace is builded.</li>
</ol>

<h3 id="devMode">Run in Development Mode</h3>
<ol>
	<li>Open the <span class="folderLocation">org.eclipse.fordiac.ide.product</span> from the <span class="folderLocation">org.eclipse.fordiac.ide.product</span> plug-in.
		<div><img src="../../html/development/img/productConfigKepler.png" alt="Eclipse product configuration"/></div>
	</li>
	<li>In the <span class="menu4diac">Testing</span> Section of the <span class="tab4diac">Overview</span> tab press <span class="button4diac">Synchronize</span></li>
	<li>To use 4diac IDE directly under this (development) Eclipse you need a type library and templates. 
	    Both are part of the 4diac IDE repository and can be found in the <span class="folderLocation">data</span> directory.
	    In order that your development 4diac IDE can find this they have to put into the directory where the target platform is stored.
	    For that copy the <span class="folderLocation">template</span> and the <span class="folderLocation">typelibrary</span> directory into the 
	    <span class="folderLocation">.metadata/.plugins/org.eclipse.pde.core/.bundle_pool</span> directory.
	</li> 
	<li>Press <span class="button4diac">Launch an Eclipse Application</span> in the <span class="view4diac">Overview</span></li>
</ol>

<h3 id="buildingIDE">Building your own 4diac IDE</h3>

<p>A big drawback for running 4diac IDE from source is that you need at least 2 Eclipse instances running. 
Especially on systems with little memory this can be an issue. 
If you still want to keep up with the developments performed in the Git repository it makes sense to build a binary package. 
See <a href="#buildBinary">Building a binary 4diac IDE package from source</a> for details on how this can be achieved.</p>

<p class="goToTop"><a href="#topOfPage">Go to top</a></p>

<h2 id="buildBinary">Building a Binary 4diac IDE Package from Source</h2>

<p>For building a binary 4diac IDE package from the source code the best is to use the Maven configuration which is also used to build 4diac IDE on our build server.
To utilize this it is best that you add the <span class="specificText">M2E - Maven Integration for Eclipse</span> to your Eclipse installation.
You can do this by invoking <span class="menu4diac">Help &rarr; Install New Software</span>.</p> 
  
<p>Then the necessary steps for generating binary 4diac IDE packages are:</p>

<ol>
	<li>Have the 4diac IDE source code in an Eclipse workspace as described in <a href="#buildFromSource">Building and Running 4diac IDE from Source</a></li>
	<li>Got to the <span class="inlineCode">org.eclipse.fordiac.ide.master</span> plugin and right click on the master.pom</li>
	<li>Invoke the <span class="menu4diac">Run As &rarr; Maven Install</span>.</li> 
	<li>After a successful build you will find the output in  <span class="folderLocation">plugins/org.eclipse.fordiac.ide.product/target/products</span> directory.</li>
</ol>

<h1>Where to go from here?</h1>

<p>Go back to Development index:</p>

<p><a href="../../html/development/developmentIndex.html">Development Index</a></p>

<p>If you want to go back to the Start Here page, we leave you here a fast access</p>

<p><a href="../../html/startHere/startHere.html">Start Here page</a></p>

<p class="goToTop">Or <a href="#topOfPage">Go to top</a></p>

</body>
</html>